(ns minify.fx
  (:require [clojurefx.protocols :as fxp]
            [clojurefx.clojurefx :as fx]
            [minify.protocals :as p])
  (:import (javafx.scene.control ChoiceBox)
           (javafx.collections ObservableList)
           (java.util Collection)))

(extend-protocol p/FXItems
  ChoiceBox
  (items [^ChoiceBox this] (.getItems this))
  (set-items! [^ChoiceBox this items] (.setAll ^ObservableList (.getItems this) ^Collection (fx/collize items)) this))

(extend-protocol fxp/FXValue
  ChoiceBox
  (value [^ChoiceBox this] (.getValue this))
  (set-value! [^ChoiceBox this value] (.setValue this value)))